﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
   abstract  class Robot
    {
        public string name { get; set; }
        public abstract void Working();

        public Robot(string name) 
        {
            this.name = name;
        }
        public  Robot aa(string a) 
        {
            Robot t;
            if (a.Equals("炒菜"))
            {
                t = new CookRobot("a",cai.炒面);
                return t ;
            }
            else if (a.Equals("传菜"))
            {
                t = new DeliveryRobot("a", 10);
                return t;
            }
            else
            {
                t = new DeliveryRobot("a", 10);

                return t;
            }
            t.Working();



        } 
    }
    enum cai
    {
        蛋炒饭,
        炒面,

    }
    class CookRobot : Robot
    {
        public cai cai { get; set; }

        public CookRobot(string name, cai cai) : base(name) 
        {
            this.cai = cai;
        }
        public override void Working()
        {
            Console.WriteLine("我是炒菜机器人,我的名字是{0},我会做{1}",name,cai);
            
        }
    }


    class DeliveryRobot : Robot
    {
        public DeliveryRobot(string name, int hours) : base(name)
        {
            this.hours = hours;
        }
        public int hours { get; set; }

        public override void Working()
        {
            Console.WriteLine("我是传菜机器人,我的名字是{0},我会做{1}", name, hours);

        }
    }
}
